﻿using AMing.Mvc4.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace AMing.Mvc4.Controllers
{
    public partial class MainController : BaseController
    {
        private Data.LocaData.PageHtmlData _pageHtmlData = null;

        public Data.LocaData.PageHtmlData PageHtmlData
        {
            get
            {
                if (_pageHtmlData == null)
                {
                    _pageHtmlData = new Data.LocaData.PageHtmlData(this.Server);
                }

                return _pageHtmlData;
            }
            set { _pageHtmlData = value; }
        }



        //
        // GET: /Main/

        public ActionResult Index()
        {
            return HostName.HostnameJump(HttpNotFound(),
                   HostNameParams(HostNameEnum._default, Index_Default),
                   HostNameParams(HostNameEnum.moepet, Index_Moepet),
                   HostNameParams(HostNameEnum.soft, Index_Soft),
                   HostNameParams(HostNameEnum.test1, Index_Test1)
                   );
        }

        public ActionResult AjaxHtml(string key)
        {
            //Model.AjaxPage.AjaxHtml ajaxHtml = new Model.AjaxPage.AjaxHtml()
            //{
            //    HeadImage = "/images/head/17605036.jpg",
            //    HeadImageLeft = 450,
            //    HeadTitleLeft = 10,
            //    HeadTitle = "一番の宝物(Mix)",
            //    HeadTitleColor = "#0066D5",
            //    AvatarTitle = "Heavenly Beats",
            //    AvatarTitleColor = "#0066D5",
            //    Html = "<h1>/images/head/17605036.jpg<br/>一番の宝物(Mix)</h1>",
            //    Js = "alert('hello');"
            //};
            //Model.AjaxPage.AjaxHtml ajaxHtml = new Model.AjaxPage.AjaxHtml()
            //{
            //    HeadImage = "/images/head/23350043.jpg",
            //    HeadImageLeft = 110,
            //    HeadTitleLeft = 320,
            //    HeadTitle = "氷花妖精伝",
            //    HeadTitleColor = "#0066D5",
            //    AvatarTitle = "遙～HARUKA",
            //    AvatarTitleColor = "#0066D5",
            //    Html = "<h1><a herf='/'>/images/head/17605036.jpg</a><br/>一番の宝物(Mix)</h1>",
            //    Js = "$('a').click(function(){$(this).hide();});"
            //};


            //PageHtmlData.WriteData("home", ajaxHtml);

            Model.AjaxPage.AjaxHtml ajaxHtml = PageHtmlData.GetData(key);

            return Json(ajaxHtml, JsonRequestBehavior.AllowGet);
        }

    }
}
